*********************************************************************************************************************** ** Human Development Report Office (HDRO), United Nations Development Programme ** Multidimensional Poverty Index 2022 release ** Methodology developed in partnership with the Oxford Poverty and Human Development Initiative, University of Oxford ************************************************************************************************************************ clear all set more off set maxvar 10000 set mem 500m *** Working Folder Path *** global path_in "C:\Users\cecilia.calderon\Documents\HDRO_MCC\MPI\MPI 2.0\Mexico 2020_ENSANUT\" global path_out "C:\Users\cecilia.calderon\Documents\HDRO_MCC\MPI\MPI 2.0\Mexico 2020_ENSANUT\" global path_ado "C:" ******************************************************************************** *** MEXICO ENSANUT 2020 *** ******************************************************************************** /* Mexico ENSANUT 2020: Data is available here: https://ensanut.insp.mx/encuestas/ensanutcontinua2020/descargas.php Anthropometric information is available for individuals aged 0-99 years.*/ ******************************************************************************** *** Step 1.1 NUTRITION DATA ******************************************************************************** use "$path_in/antropometria_ensanut2020_w.dta", clear *** Household unique id gen hh_id = FOLIO_I lab var hh_id "Household ID" *** Individual unique id gen ind_id = FOLIO_INT label var ind_id "Individual ID" duplicates report hh_id duplicates report ind_id *** Variable: SEX *** lookfor sexo gen sex = H0302 tab sex, m * "1" for male ;"2" for female tab sex, nol clonevar gender = sex desc gender tab gender,m *** Variable: AGE *** lookfor edad gen edad = H0303 codebook edad, tab (999) //edad = age in years //edad_meses = age in months gen age_month = (H0303*12) + MESES desc age_month summ age_month gen str6 ageunit = "months" lab var ageunit "Months" lab var age_month "Age in months" foreach var in an01_1 an01_2 an04_01 an04_02 { replace `var'=. if `var'>=222 /* 222.2 = person was not measured */ } *** Variable: BODY WEIGHT (KILOGRAMS) *** lookfor peso codebook an01_1, tab (9999) //an01_1 = first measure (in kg) codebook an01_2, tab (9999) //an01_2 = second measure(in kg) compare an01_1 an01_2 /* weight was measured twice, so we take the average of the 2 measures */ egen weight = rmean(an01_1 an01_2) lookfor an03 tab an03, miss //an03 = result of weight measurement label define lab_weight 1 "without problem" 2 "physical problem" 3 "didn't cope" 4 "didn't cooperate" label values an03 lab_weight tab an03 weight if weight>=9990 | weight==., miss //468 missing values for weight explained desc weight summ weight *** Variable: HEIGHT (CENTIMETERS) lookfor talla codebook an04_01, tab (9999) //an04_01 = first measure (in cm) codebook an04_02, tab (9999) //an04_02 = second measure (in cm) compare an04_01 an04_02 /* height was measured twice, so we take the average of the 2 measures */ egen height = rmean(an04_01 an04_02) lookfor an05 tab an05, miss //an05 = result of height measurement label define lab_height 1 "without problem" 2 "physical problem" 3"didn't cope" 4 "didn't cooperate" label values an05 lab_height tab an05 height if height>=9990 | height==., miss //74 missing values for height explained desc height summ height *** Variable: MEASURED STANDING/LYING DOWN *** /*Note: MEXICO ENSANUT 2020: LONGITUD PARA TODOS LOS SELECCIONADOS MENORES DE 24 MESES TALLA PARA TODOS LOS SELECCIONADOS DE 2 A 59 AÑOS*/ gen measure = "l" if age_month<24 * Child measured lying down<24 replace measure = "h" if age_month>=24 & age_month<. * Person measured standing up *** Variable: OEDEMA *** /*Note:MEXICO ENSANUT 2020 has no information on oedema. So it is assumed that no-one has oedema*/ lookfor oedema gen oedema = "n" desc oedema tab oedema *** Variable: INDIVIDUAL SAMPLING WEIGHT *** lookfor ponde //"ponde_f" = final weight gen sw = ponde_g20 desc sw summ sw /*Save file in order to use the .dta file to compute nutrition indicators individually for children under 5, teenagers, and adults */ save "$path_out/nutri_temp.dta", replace ******************************************************************************** *** Step 1.1a Nutrition indicators for children under 5 ******************************************************************************** clear use "$path_out/nutri_temp.dta" sort ind_id gen child_KR=1 if age_month<61 * 1,618 children under 5y keep if child_KR==1 //Retain observations of those children aged 60 months & younger tab age_month, miss /* For this part of the do-file we use the WHO Anthro and macros. This is to calculate the z-scores of children under 5. Source of ado file: http://www.who.int/childgrowth/software/en/ */ *** Indicate to STATA where the igrowup_restricted.ado file is stored: adopath + "$path_ado/igrowup_stata" *** We will now create three nutritional variables for children under 5: *** weight-for-age (underweight), *** weight-for-height (wasting) *** height-for-age (stunting) /* We use 'reflib' to specify the package directory where the .dta files containing the WHO Child Growth Standards are stored. */ gen str100 reflib = "$path_ado/igrowup_stata" lab var reflib "Directory of reference tables" /* We use datalib to specify the working directory where the input STATA dataset containing the anthropometric measurement is stored. */ gen str100 datalib = "$path_out" lab var datalib "Directory for datafiles" /* We use datalab to specify the name that will prefix the output files that will be produced from using this ado file*/ gen str30 datalab = "children_nutri_mex" lab var datalab "Working file" //We now run the command to calculate the z-scores with the adofile igrowup_restricted reflib datalib datalab gender age_month ageunit weight height measure oedema sw /*We now turn to using the dta file that was created and that contains the calculated z-scores to create the child nutrition variables following WHO standards */ use "$path_out/children_nutri_mex_z_rc.dta", clear *** Standard MPI indicator *** //Takes value 1 if the child is under 2 stdev below the median & 0 otherwise gen underweight = (_zwei < -2.0) replace underweight = . if _zwei == . | _fwei==1 lab var underweight "Child is undernourished (weight-for-age) 2sd - WHO" tab underweight, miss gen stunting = (_zlen < -2.0) replace stunting = . if _zlen == . | _flen==1 lab var stunting "Child is stunted (length/height-for-age) 2sd - WHO" tab stunting, miss gen wasting = (_zwfl < - 2.0) replace wasting = . if _zwfl == . | _fwfl == 1 lab var wasting "Child is wasted (weight-for-length/height) 2sd - WHO" tab wasting, miss count if _fwei==1 | _flen==1 /*Note: In Mexico ENSANUT 2020, 31 children were replaced as missing because they have extreme z-scores which are biologically implausible. */ //Retain relevant variables: keep FOLIO_I ID_INT FOLIO_INT hh_id ind_id child_KR age_month underweight* stunting* wasting* ponde_g ponde_g20 order FOLIO_I ID_INT FOLIO_INT hh_id ind_id child_KR age_month underweight* stunting* wasting* ponde_g ponde_g20 sort FOLIO_I FOLIO_INT duplicates report FOLIO_INT save "$path_out/MEX20_KR.dta", replace //Erase files from folder: erase "$path_out/children_nutri_mex_z_rc.xls" erase "$path_out/children_nutri_mex_prev_rc.xls" *erase "$path_out/children_nutri_mex_z_rc.dta" ******************************************************************************** *** Step 1.1b BMI-for-age for individuals above 5 years & under 20 years ******************************************************************************** use "$path_out/nutri_temp.dta", clear count if age_month>=61 & age_month<229 keep if age_month>=61 & age_month<229 * 2,965 persons /* For this part of the do-file we use the WHO AnthroPlus software. This is to calculate the z-scores for young individuals above 5 years & under 20 years. Source of ado file: https://www.who.int/growthref/tools/en/ */ *** Indicate to STATA where the igrowup_restricted.ado file is stored: adopath + "C:\Users\cecilia.calderon\Documents\HDRO_MCC\MPI\WHO 2007 stata\" /* We use 'reflib' to specify the package directory where the .dta files containing the WHO Growth reference are stored. Note that we use strX to specity the length of the path in string. */ gen str100 reflib = "C:\WHO 2007 Stata" lab var reflib "Directory of reference tables" /* We use datalib to specify the working directory where the input STATA data set containing the anthropometric measurement is stored. */ gen str100 datalib = "$path_out" lab var datalib "Directory for datafiles" /* We use datalab to specify the name that will prefix the output files that will be produced from using this ado file*/ gen str30 datalab = "teen_nutri_MEX20" lab var datalab "Working file" //We now run the command to calculate the z-scores with the adofile who2007 reflib datalib datalab gender age_month ageunit weight height oedema sw /*We now turn to using the dta file that was created and that contains the calculated z-scores to compute BMI-for-age*/ use "$path_out/teen_nutri_MEX20_z.dta", clear gen z_bmi = _zbfa replace z_bmi = . if _fbfa==1 lab var z_bmi "z-score bmi-for-age WHO" *** Standard MPI indicator *** gen low_bmiage = (z_bmi < -2.0) /*Takes value 1 if BMI-for-age is under 2 stdev below the median & 0 otherwise */ replace low_bmiage = . if z_bmi==. lab var low_bmiage "Teenage low bmi 2sd - WHO" //Identification variable for children above 5 years and under 20 years gen teen_IR=1 sort hh_id ind_id duplicates report hh_id ind_id //No duplicates at this stage //Retain relevant variables: keep FOLIO_I ID_INT FOLIO_INT hh_id ind_id teen_IR age_month low_bmiage* ponde_g ponde_g20 order FOLIO_I ID_INT FOLIO_INT hh_id ind_id teen_IR age_month low_bmiage* ponde_g ponde_g20 /*Append the nutrition information of children above 5 years with children under 5 */ append using "$path_out/MEX20_KR.dta" sort FOLIO_I FOLIO_INT save "$path_out/MEX20_children.dta", replace //Erase files from folder: erase "$path_out/teen_nutri_MEX20_z.xls" erase "$path_out/teen_nutri_MEX20_prev.xls" *erase "$path_out/teen_nutri_MEX20_z.dta" *erase "$path_out/MEX20_KR.dta" ******************************************************************************** *** Step 1.1c BMI for older individuals in the dataset ******************************************************************************** clear use "$path_out/nutri_temp.dta", clear count if age_month>=229 & age_month<. * 10,127 people keep if age_month>=229 & age_month<. *** Variable: ADULT BMI *** gen bmi=(weight)/((height/100)^2) lab var bmi "BMI" gen low_bmi = (bmi<18.5) replace low_bmi=. if bmi==. *replace low_bmi = . if age_month>840 & age_month<. /*Replace individuals who are older than 70 years with '.' even if they had provided nutrition information since the global MPI does not take into account nutrition information of those 70 years and above. */ lab var low_bmi "BMI <18.5" lab define lab_low_bmi 1 "bmi<18.5" 0 "bmi>=18.5" lab values low_bmi lab_low_bmi tab low_bmi, miss append using "$path_out/MEX20_children.dta" rename weight weight_kg rename height height_cm rename sex sex_nutri duplicates report FOLIO_I FOLIO_INT sort FOLIO_INT //Save a temp file for merging later: save "$path_out/MEX20_NUTRI.dta", replace ******************************************************************************** *** Step 1.2 HOUSEHOLD RECODE ******************************************************************************** use "$path_in/hogar_ensanut2020_ww.dta", clear keep FOLIO_I H0101 H0102 H0103 H0104 H0105 H0106 H0107 H0108 H0109 H0111 H0112 H0113 H0114 H0114B H0114C H0114DA H0114DB H0114DC H0114DD H0115 H0117 H0118 H0119 H0120 H0121 H0122 H0123 H0124A H0125B H0125C H0125D H0125E NOTA2 H0201 H0202 H0203 H0204 H0205 NOTA3 NUM_INT H305T NOTA6 H0601A H0601B H0601C H0601D H0601E H0601F H0601G H0601H H0601I H0601J H0601K H0601L H0601M H0601N H0601O Upm region_cv estrato est_sel ponde_f ponde_g rural_20 ponde_f20 ponde_g20 area_20 foreach var in Upm region_cv estrato est_sel ponde_f ponde_g rural_20 ponde_f20 ponde_g20 area_20 { ren `var' `var'_HH } sort FOLIO_I save "$path_out/MEX20_HH.dta", replace ******************************************************************************** *** Step 1.3 HOUSEHOLD MEMBER'S RECODE ******************************************************************************** use "$path_in/integrantes_ensanut2020_w.dta", clear *** Household unique id gen hh_id = FOLIO_I lab var hh_id "Household ID" *** Individual unique id gen ind_id = FOLIO_INT label var ind_id "Individual ID" duplicates report hh_id duplicates report ind_id sort FOLIO_I FOLIO_INT ******************************************************************************** *** 1.4 DATA MERGING ******************************************************************************** *** Merging household recode *************************************************** merge m:1 FOLIO_I using "$path_out/MEX20_HH.dta" // 36,103 observations matched (100%) drop _merge *erase "$path_out/MEX20_HR.dta" *** Merging nutrition data *************************************************** merge 1:1 FOLIO_I FOLIO_INT using "$path_out/MEX20_NUTRI.dta" // 14,710 observations matched drop _merge *erase "$path_out/MEX20_NUTRI.dta" ******************************************************************************** *** 1.5 RENAMING DEMOGRAPHIC VARIABLES *** ******************************************************************************** //Sample weight desc pond* clonevar weight = ponde_f20 label var weight "Individual sample weight" //Area: urban or rural gen area = 1 if area_20==1 replace area = 0 if area_20==2 label define lab_area 1 "urban" 0 "rural" label values area lab_area label var area "Area: urban-rural" tab area area_20, m //Sex of household member codebook H0302 clonevar sex = H0302 label var sex "Sex of household member" //Age of household member codebook H0303, tab (999) clonevar age = H0303 replace age = . if age>=900 label var age "Age of household member" //Age group recode age (0/4 = 1 "0-4")(5/9 = 2 "5-9")(10/14 = 3 "10-14") (15/17 = 4 "15-17")(18/59 = 5 "18-59")(60/max=6 "60+"), gen(agec7) lab var agec7 "age groups (7 groups)" recode age (0/9 = 1 "0-9") (10/17 = 2 "10-17")(18/59 = 3 "18-59") (60/max=4 "60+"), gen(agec4) lab var agec4 "age groups (4 groups)" //Marital status of household member codebook H0319 gen marital = 1 if H0319 == 7 | H0319==1 replace marital = 2 if H0319 == 6 replace marital = 3 if H0319 == 5 replace marital = 4 if H0319 == 4 replace marital = 5 if H0319 == 2 | H0319==3 label define lab_mar 1"never married" 2"currently married" 3"widowed" 4"divorced" 5"not living together" label values marital lab_mar label var marital "Marital status of household member" tab H0319 marital, miss //Total number of de jure hh members in the household drop if VIVO==2 gen member = 1 bysort hh_id: egen hhsize = sum(member) label var hhsize "Household size" tab hhsize, miss drop member compare hhsize H0204 //Subnational region lookfor region tab region_cv, miss lab var region_cv "Region for subnational decomposition" drop region_cv_HH ta region,m ******************************************************************************** *** Step 2 Data preparation *** *** Standardization of the 10 Global MPI indicators *** Identification of non-deprived & deprived individuals ******************************************************************************** ******************************************************************************** *** Step 2.1 Years of Schooling *** ******************************************************************************** * Official entrance age to primary education in Mexico is 6 years old. * Duration in primary: 6 years * Duration in lower secondary: 3 years * Duration in upper secondary: 3 years * Source: "http://data.uis.unesco.org/?ReportId=163" gen nivel = H0317A gen grado = H0317G tab nivel grado, m gen eduyears = 0 if nivel==0 | nivel==1 replace eduyears= 1 if (nivel==2 | nivel==5) & grado==1 replace eduyears= 2 if (nivel==2 | nivel==5) & grado==2 replace eduyears= 3 if (nivel==2 | nivel==5) & grado==3 replace eduyears= 4 if (nivel==2 | nivel==5) & grado==4 replace eduyears= 5 if (nivel==2 | nivel==5) & grado==5 replace eduyears= 6 if (nivel==2 | nivel==5) & grado==6 replace eduyears= 7 if nivel==3 & grado==1 replace eduyears= 8 if nivel==3 & grado==2 replace eduyears= 9 if nivel==3 & grado==3 replace eduyears= 10 if nivel==4 & grado==1 replace eduyears= 11 if nivel==4 & grado==2 replace eduyears= 12 if nivel==4 & grado==3 replace eduyears= 7 if nivel==6 & grado==1 /*Estudios técnicos o comerciales con primaria terminada*/ replace eduyears= 8 if nivel==6 & grado==2 replace eduyears= 9 if nivel==6 & (grado==3 | grado==4) replace eduyears= 10 if nivel==7 & grado==1 /*Estudios técnicos o comerciales con secundaria terminada*/ replace eduyears= 11 if nivel==7 & grado==2 replace eduyears= 12 if nivel==7 & (grado==3 | grado==4) replace eduyears= 13 if nivel==8 & grado==1 /*Estudios técnicos o comerciales con preparatoria terminada*/ replace eduyears= 14 if nivel==8 & grado==2 replace eduyears= 15 if nivel==8 & (grado==3 | grado==4) replace eduyears= 13 if (nivel==9 | nivel==10) & grado==1 /*Licenciatura*/ replace eduyears= 14 if (nivel==9 | nivel==10) & grado==2 replace eduyears= 15 if (nivel==9 | nivel==10) & grado==3 replace eduyears= 16 if (nivel==9 | nivel==10) & grado==4 replace eduyears= 17 if (nivel==9 | nivel==10) & (grado==5 | grado==6) replace eduyears= 18 if (nivel==11 | nivel==12) & grado==1 /*Master/PhD*/ replace eduyears= 19 if (nivel==11 | nivel==12) & grado==2 replace eduyears= 20 if (nivel==11 | nivel==12) & grado==3 replace eduyears= 21 if (nivel==11 | nivel==12) & grado==4 replace eduyears= 22 if (nivel==11 | nivel==12) & (grado==5 | grado==6) *total number of years of education replace eduyears = . if eduyears>30 *recode any unreasonable years of highest education as missing value replace eduyears = . if eduyears>=age & age>0 replace eduyears = 0 if age < 10 replace eduyears = 0 if (age==10 | age==11) & eduyears < 6 /*The variable "eduyears" was replaced with a '0' given that the criteria for this indicator is household member aged 12 years or older */ /*A control variable is created on whether there is information on years of education for at least 2/3 of the household members. */ gen temp = 1 if (eduyears!=. & (age>=12 & age!=.)) | (((age==10 | age==11) & eduyears>=6 & eduyears<.)) bysort hh_id: egen no_missing_edu = sum(temp) /*Total household members who are 12 years and older with no missing years of education but recognizing as an achievement if the member is 10 or 11 and already completed 6 yrs of schooling */ gen temp2 = 1 if (age>=12 & age!=.) | (((age==10 | age==11) & eduyears>=6 & eduyears<.)) bysort hh_id: egen hhs = sum(temp2) *Total number of household members who are 12 years and older replace no_missing_edu = no_missing_edu/hhs replace no_missing_edu = (no_missing_edu>=2/3) /*Identify whether there is information on years of education for at least 2/3 of the household members aged 12 years and older */ tab no_missing_edu, miss label var no_missing_edu "No missing edu for at least 2/3 of the HH members aged 12 years & older" drop temp temp2 hhs /*The entire household is considered deprived if no household member aged 12 years or older has completed SIX years of schooling. */ gen years_edu6 = (eduyears>=6) /* The years of schooling indicator takes a value of "1" if at least someone in the hh has reported 6 years of education or more */ replace years_edu6 = . if eduyears==. bysort hh_id: egen hh_years_edu6_1 = max(years_edu6) gen hh_years_edu6 = (hh_years_edu6_1==1) replace hh_years_edu6 = . if hh_years_edu6_1==. replace hh_years_edu6 = . if hh_years_edu6==0 & no_missing_edu==0 lab var hh_years_edu6 "Household has at least one member with 6 years of edu" ******************************************************************************** *** Step 2.2 Child School Attendance *** ******************************************************************************** tab age H0313, m gen attendance = 0 if H0313==2 //not currently attending replace attendance = 1 if H0313==1 //currently attending replace attendance = 0 if age<5 | age>24 //Replace attendance with '0' for individuals who are not of school age label define lab_attendance 1 "currently attending" 0 "not currently attending" label values attendance lab_attendance lab var attendance "Currently attending school" tab attendance H0313, m *** Standard MPI *** ******************************************************************* /*The entire household is considered deprived if any school-aged child is not attending school up to class 8. */ gen child_schoolage = (age>=6 & age<=14) /* Note: In Mexico, the official school entrance age is 6 years So, age range is 6-14 (=6+8). Source: "http://data.uis.unesco.org/?ReportId=163" Go to Education>Education>System>Official entrance age to primary education. Look at the starting age and add 8. */ /* A control variable is created on whether there is no information on school attendance for at least 2/3 of the school age children */ count if child_schoolage==1 & attendance==. //Understand how many eligible school aged children are not attending school gen temp = 1 if child_schoolage==1 & attendance!=. bysort hh_id: egen no_missing_atten = sum(temp) /*Total school age children with no missing information on school attendance */ gen temp2 = 1 if child_schoolage==1 bysort hh_id: egen hhs = sum(temp2) //Total number of household members who are of school age replace no_missing_atten = no_missing_atten/hhs replace no_missing_atten = (no_missing_atten>=2/3) /*Identify whether there is missing information on school attendance for more than 2/3 of the school age children */ tab no_missing_atten, m label var no_missing_atten "No missing school attendance for at least 2/3 of the school aged children" drop temp temp2 hhs bysort hh_id: egen hh_children_schoolage = sum(child_schoolage) replace hh_children_schoolage = (hh_children_schoolage>0) //Control variable: //It takes value 1 if the household has children in school age lab var hh_children_schoolage "Household has children in school age" gen child_not_atten = (attendance==0) if child_schoolage==1 replace child_not_atten = . if attendance==. & child_schoolage==1 bysort hh_id: egen any_child_not_atten = max(child_not_atten) gen hh_child_atten = (any_child_not_atten==0) replace hh_child_atten = . if any_child_not_atten==. replace hh_child_atten = 1 if hh_children_schoolage==0 replace hh_child_atten = . if hh_child_atten==1 & no_missing_atten==0 /*If the household has been intially identified as non-deprived, but has missing school attendance for at least 2/3 of the school aged children, then we replace this household with a value of '.' because there is insufficient information to conclusively conclude that the household is not deprived */ lab var hh_child_atten "Household has all school age children up to class 8 in school" tab hh_child_atten, m /*Note: The indicator takes value 1 if ALL children in school age are attending school and 0 if there is at least one child not attending. Households with no children receive a value of 1 as non-deprived. The indicator has a missing value only when there are all missing values on children attendance in households that have children in school age. */ ******************************************************************************** *** Step 2.3 Nutrition *** ******************************************************************************** /*Note: Mexico ENSANUT 2020: Anthropometric information were recorded for individuals 0-99 years. This departs from the usual DHS surveys that tend to collect anthropometric data only from adults between the age group of 15-49 or 15-59 years. For the purpose of the global MPI, we have used nutrition data when the data is available for all individuals but up to the age of 70 years. Hence, in the case of Mexico, we make use of the anthropometric data for children under 5 years, young individuals older than 5 years and under 20 years, and finally adult women and men aged 20-70 years. */ count if age_month!=. * 14,710 individuals aged 0-99 years with antrhopometric information count if age_month<=840 * 13,737 individuals aged 0-70 years with anthropometric information replace H0303=. if H0303==999 gen age_month_all = (H0303*12) + MESES ***As a first step, construct the eligibility criteria *** No Eligible Women, Men or Children for Nutrition ****************************************************** gen nutri_eligible = age_month_all<=840 bysort hh_id: egen n_nutri_eligible = sum(nutri_eligible) gen no_nutri_eligible = (n_nutri_eligible==0) lab var no_nutri_eligible "Household has no eligible women, men, or children" tab no_nutri_eligible, m drop n_nutri_eligible gen child_eligible = age_month_all<61 bysort hh_id: egen n_child_eligible = sum(child_eligible) gen no_child_eligible = (n_child_eligible==0) lab var no_child_eligible "Household has no eligible children <61 months" tab no_child_eligible, m drop child_eligible n_child_eligible gen child = 1 if age_month<61 gen youth = 1 if age_month>=61 & age_month<229 gen adult = 1 if age_month>=229 & age_month<=840 gen nutri = 1 if stunting==1 | underweight==1 replace nutri = 0 if stunting==0 & underweight==0 tab nutri if child==1, m replace nutri = 1 if low_bmiage==1 & nutri==. & youth==1 replace nutri = 0 if low_bmiage==0 & nutri==. & youth==1 replace nutri = 1 if low_bmi==1 & nutri==. & adult==1 replace nutri = 0 if low_bmi==0 & nutri==. & adult==1 replace nutri = . if age_month_all>840 & age_month_all<. bysort hh_id: egen temp = max(nutri) gen hh_nutrition_uw_st = (temp==0) replace hh_nutrition_uw_st = . if temp==. replace hh_nutrition_uw_st = 1 if no_nutri_eligible==1 /*We replace households that do not have the applicable population, that is, women and men up to 70 years and children under 5, as non-deprived in nutrition*/ lab var hh_nutrition_uw_st "Household has no child underweight/stunted or adult deprived by BMI/BMI-for-age" lab value hh_nutrition_uw_st lab_nutri tab hh_nutrition_uw_st, m ******************************************************************************** *** Step 2.5 Electricity *** ******************************************************************************** /*Members of the household are considered deprived if the household has no electricity */ *** Standard MPI *** **************************************** lookfor H0111 *H0111 = is there electricity in this household? clonevar electricity = H0111 codebook electricity, tab (10) * 1 = yes, 2 = no recode electricity (2=0) lab define lab_yes_no 0 "no" 1 "yes" lab values electricity lab_yes_no label var electricity "Electricity" ******************************************************************************** *** Step 2.6 Sanitation *** ******************************************************************************** /* Improved sanitation facilities include flush or pour flush toilets to sewer systems, septic tanks or pit latrines, ventilated improved pit latrines, pit latrines with a slab, and composting toilets. These facilities are only considered improved if it is private, that is, it is not shared with other households. Source: https://unstats.un.org/sdgs/metadata/files/Metadata-06-02-01.pdf Note: In cases of mismatch between the country report and the internationally agreed guideline, we followed the report.*/ gen toilet_mdg = 1 if H0115>=1 & H0115<=4 replace toilet_mdg = 0 if H0117==3 | H0117==4 | H0115==5 replace toilet_mdg = 0 if H0118==1 /* shared */ lab var toilet_mdg "Household has improved sanitation with MDG Standards" tab toilet toilet_mdg, miss /* ta H0115 H0117,m H0115 ¿Esta vivienda | tiene drenaje o | desagüe conectado | H0117 ¿El servicio sanitario... a... | tiene des le echan no se le no tiene . | Total ----------------------+-------------------------------------------------------+---------- la red pública? | 22,513 5,436 27 23 0 | 27,999 una fosa séptica o ta | 2,543 3,819 468 71 0 | 6,901 una tubería que va a | 108 128 33 16 0 | 285 una tubería que va a | 20 24 0 0 0 | 44 ¿No tiene drenaje? | 28 117 91 347 0 | 583 . | 0 0 0 0 212 | 212 ----------------------+-------------------------------------------------------+---------- Total | 25,212 9,524 619 457 212 | 36,024 ta H0115 H0117,m nol H0115 | ¿Esta | vivienda | tiene | drenaje o | desagüe | conectado | H0117 ¿El servicio sanitario... a... | 1 2 3 4 . | Total -----------+-------------------------------------------------------+---------- 1 | 22,513 5,436 27 23 0 | 27,999 2 | 2,543 3,819 468 71 0 | 6,901 3 | 108 128 33 16 0 | 285 4 | 20 24 0 0 0 | 44 5 | 28 117 91 347 0 | 583 . | 0 0 0 0 212 | 212 -----------+-------------------------------------------------------+---------- Total | 25,212 9,524 619 457 212 | 36,024 */ ******************************************************************************** *** Step 2.7 Drinking Water *** ******************************************************************************** /* Improved drinking water sources include the following: piped water into dwelling, yard or plot; public taps or standpipes; boreholes or tubewells; protected dug wells; protected springs; packaged water; delivered water and rainwater which is located on premises or is less than a 30-minute walk from home roundtrip. Source: https://unstats.un.org/sdgs/metadata/files/Metadata-06-01-01.pdf Note: In cases of mismatch between the country report and the internationally agreed guideline, we followed the report.*/ /*NOTE: Mexico ENSANUT 2020 does not have information on the the time it takes to collect drinking water, if it is outside of the household premise. */ codebook H0112, tab (99) gen water_mdg = 0 if H0114==1 | H0114==5 replace water_mdg = 1 if H0112==1 | H0112==2 | H0114==2 | H0114==3 | H0114==4 | H0114==6 lab var water_mdg "Household has drinking water with MDG standards (not considering distance)" tab water water_mdg, miss ******************************************************************************** *** Step 2.8 Housing *** ******************************************************************************** /* Members of the household are considered deprived if the household has a dirt, sand or dung floor */ codebook H0103, tab(10) gen floor_imp = 0 if H0103==1 replace floor_imp = 1 if H0103==2 | H0103==3 lab var floor_imp "Household has floor that it is not earth/sand/dung" tab H0103 floor_imp, m /* Members of the household are considered deprived if the household has walls made of natural or rudimentary materials */ codebook H0102, tab(10) gen wall_imp = 0 if H0102<=5 replace wall_imp = 1 if H0102==6 | H0102==7 | H0102==8 lab var wall_imp "Household has wall that it is not of low quality materials" tab H0102 wall_imp, m /* Members of the household are considered deprived if the household has roof made of natural or rudimentary materials we follow the classification in the MICS 2015 questionnaire for some categories */ codebook H0101, tab(10) gen roof_imp = 0 if H0101<=5 replace roof_imp = 1 if H0101>=6 & H0101<=9 lab var roof_imp "Household has roof that it is not of low quality materials" tab H0101 roof_imp, m /* we follow the classification in the MICS 2015 questionnaire for some categories */ *** Standard MPI *** /* Members of the household is deprived in housing if the roof, floor OR walls are constructed from low quality materials.*/ ************************************************************** gen housing_1 = 1 replace housing_1 = 0 if floor_imp==0 | wall_imp==0 | roof_imp==0 replace housing_1 = . if floor_imp==. & wall_imp==. & roof_imp==. lab var housing_1 "Household has roof, floor & walls that it is not low quality material" tab housing_1, m ******************************************************************************** *** Step 2.9 Cooking Fuel *** ******************************************************************************** /* Solid fuel are solid materials burned as fuels, which includes coal as well as solid biomass fuels (wood, animal dung, crop wastes and charcoal). Source: https://apps.who.int/iris/bitstream/handle/10665/141496/9789241548885_eng.pdf */ *** Standard MPI *** **************************************** gen cooking_mdg = 0 if H0109==1 | H0109==2 replace cooking_mdg = 1 if H0109==3 |H0109==4 | H0109==5 | H0109==6 | H0109==7 | H0107==4 /* p1_7=4 = no cocinan */ lab var cooking_mdg "Househod has cooking fuel according to MDG standards" tab H0109 cooking_mdg, miss ******************************************************************************** *** Step 2.10 Assets ownership *** ******************************************************************************** /*Assets that are included in the global MPI: Radio, TV, telephone, bicycle, motorbike, refrigerator, car, computer and animal cart */ //Television gen television = 1 if H0601A==1 replace television = 0 if H0601A==2 label var television "The household has at least one TV (analogic or digital)" gen bw_television = . ta H0601A television,m //Radio gen radio = 1 if H0601C==1 replace radio = 0 if H0601C==2 label var radio "The household has at least one radio (normal or radio recorder)" ta H0601C radio,m //Telephone gen telephone = 1 if H0601H==1 replace telephone = 0 if H0601H==2 label var telephone "The household has a telephone" ta H0601H telephone,m //Mobilephone gen mobiletelephone = 1 if H0601F==1 replace mobiletelephone = 0 if H0601F==2 label var mobiletelephone "The household has a mobilephone" ta H0601F mobile,m //Refrigerator gen refrigerator = 1 if H0601K==1 replace refrigerator = 0 if H0601K==2 label var refrigerator "The household has at least one refrigerator" ta H0601K refrig,m //Car (includes car and truck) gen car = 1 if H0125B==1 | H0125C==1 replace car = 0 if H0125B==2 & H0125C==2 label var car "The household has at least one car/truck)" bys car: ta H0125B H0125C,m //Bicycle: no data gen bicycle = . label var bicycle "The household has at least one bicycle" //Motorbike gen motorbike = 1 if H0125D==1 replace motorbike = 0 if H0125D==2 label var motorbike "The household has at least one motorbike" ta H0125D motor,m //Computer gen computer = 1 if H0601E==1 replace computer = 0 if H0601E==2 label var computer "The household has at least one computer" ta H0601E compu,m //Animal cart: no data gen animal_cart = . label define assets 1 "Yes" 0 "No" label values television assets label values radio assets label values telephone assets label values mobiletelephone assets label values refrigerator assets label values car assets label values bicycle assets label values motorbike assets label values computer assets label values animal_cart assets //Combine information on telephone and mobiletelephone replace telephone=1 if mobiletelephone==1 *** Standard MPI *** **************************************** /* Members of the household are considered deprived in assets if the household does not own more than one of: radio, TV, telephone, bike, motorbike, refrigerator, computer or animal_cart and does not own a car or truck.*/ egen n_small_assets2 = rowtotal(television radio telephone refrigerator bicycle motorbike computer animal_cart), missing lab var n_small_assets2 "Household Number of Small Assets Owned" gen hh_assets2 = (car==1 | n_small_assets2 > 1) replace hh_assets2 = . if car==. & n_small_assets2==. lab var hh_assets2 "Household Asset Ownership: HH has car or more than 1 small assets incl computer & animal cart" ******************************************************************************** *** Step 2.11 Rename and keep variables for MPI calculation ******************************************************************************** //Retain data on sampling design: lookfor estrato upm *desc est_var code_upm clonevar strata = estrato clonevar psu = Upm //Retain year, month & date of interview: lookfor tiempo_gen *desc tiempo_gen gen year_interview = . gen month_interview = . gen date_interview = . //Generate presence of subsample gen subsample = . gen hh_mortality = . recode hh_mortality (0=1)(1=0) , gen(d_cm) recode hh_nutrition_uw_st (0=1)(1=0) , gen(d_nutr) recode hh_child_atten (0=1)(1=0) , gen(d_satt) recode hh_years_edu6 (0=1)(1=0) , gen(d_educ) recode electricity (0=1)(1=0) , gen(d_elct) recode water_mdg (0=1)(1=0) , gen(d_wtr) recode toilet_mdg (0=1)(1=0) , gen(d_sani) recode housing_1 (0=1)(1=0) , gen(d_hsg) recode cooking_mdg (0=1)(1=0) , gen(d_ckfl) recode hh_assets2 (0=1)(1=0) , gen(d_asst) *** Keep selected variables for global MPI estimation *** keep hh_id ind_id subsample strata psu weight area sex age agec7 agec4 marital hhsize region year_interview month_interview date_interview d_cm d_nutr d_satt d_educ d_elct d_wtr d_sani d_hsg d_ckfl d_asst hh_mortality hh_nutrition_uw_st hh_child_atten hh_years_edu6 electricity water_mdg toilet_mdg housing_1 cooking_mdg hh_assets2 order hh_id ind_id subsample strata psu weight area sex age agec7 agec4 marital hhsize region year_interview month_interview date_interview d_cm d_nutr d_satt d_educ d_elct d_wtr d_sani d_hsg d_ckfl d_asst hh_mortality hh_nutrition_uw_st hh_child_atten hh_years_edu6 electricity water_mdg toilet_mdg housing_1 cooking_mdg hh_assets2 *** Sort, compress and save data for estimation *** sort ind_id compress save "$path_out/mex_ensanut20_pov.dta", replace ******************************************************************************** *** MPI Calculation (TTD file) ******************************************************************************** **SELECT COUNTRY POV FILE RUN ON LOOP FOR MORE COUNTRIES use "$path_out\mex_ensanut20_pov.dta", clear ******************************************************************************** *** Define Sample Weight and total population *** ******************************************************************************** gen sample_weight = weight ******************************************************************************** *** List of the 10 indicators included in the MPI *** ******************************************************************************** gen edu_1 = hh_years_edu6 gen atten_1 = hh_child_atten gen cm_1 = hh_mortality gen nutri_1 = hh_nutrition_uw_st gen elec_1 = electricity gen toilet_1 = toilet_mdg gen water_1 = water_mdg gen house_1 = housing_1 gen fuel_1 = cooking_mdg gen asset_1 = hh_assets2 global est_1 edu_1 atten_1 nutri_1 elec_1 toilet_1 water_1 house_1 fuel_1 asset_1 ******************************************************************************** *** List of sample without missing values *** ******************************************************************************** foreach j of numlist 1 { gen sample_`j' = (edu_`j'!=. & atten_`j'!=. & nutri_`j'!=. & elec_`j'!=. & toilet_`j'!=. & water_`j'!=. & house_`j'!=. & fuel_`j'!=. & asset_`j'!=.) replace sample_`j' = . if subsample==0 /* Note: If the anthropometric data was collected from a subsample of the total population that was sampled, then the final analysis only includes the subsample population. */ *** Percentage sample after dropping missing values *** sum sample_`j' [iw = sample_weight] gen per_sample_weighted_`j' = r(mean) sum sample_`j' gen per_sample_`j' = r(mean) } *** ******************************************************************************** *** Define deprivation matrix 'g0' *** which takes values 1 if individual is deprived in the particular *** indicator according to deprivation cutoff z as defined during step 2 *** ******************************************************************************** foreach j of numlist 1 { foreach var in ${est_`j'} { gen g0`j'_`var' = 1 if `var'==0 replace g0`j'_`var' = 0 if `var'==1 } } *** Raw Headcount Ratios foreach j of numlist 1 { foreach var in ${est_`j'} { sum g0`j'_`var' if sample_`j'==1 [iw = sample_weight] gen raw`j'_`var' = r(mean)*100 lab var raw`j'_`var' "Raw Headcount: Percentage of people who are deprived in `var'" } } ******************************************************************************** *** Define vector 'w' of dimensional and indicator weight *** ******************************************************************************** /*If survey lacks one or more indicators, weights need to be adjusted within / each dimension such that each dimension weighs 1/3 and the indicator weights add up to one (100%). CHECK COUNTRY FILE*/ foreach j of numlist 1 { // DIMENSION EDUCATION foreach var in edu_`j' atten_`j' { capture drop w`j'_`var' gen w`j'_`var' = 1/6 } // DIMENSION HEALTH foreach var in nutri_`j' { capture drop w`j'_`var' gen w`j'_`var' = 1/3 } // DIMENSION LIVING STANDARD foreach var in elec_`j' toilet_`j' water_`j' house_`j' fuel_`j' asset_`j' { capture drop w`j'_`var' gen w`j'_`var' = 1/18 } } ******************************************************************************** *** Generate the weighted deprivation matrix 'w' * 'g0' ******************************************************************************** foreach j of numlist 1 { foreach var in ${est_`j'} { gen w`j'_g0_`var' = w`j'_`var' * g0`j'_`var' replace w`j'_g0_`var' = . if sample_`j'!=1 /*The estimation is based only on observations that have non-missing values for all variables in varlist_pov*/ } } ******************************************************************************** *** Generate the vector of individual weighted deprivation count 'c' ******************************************************************************** foreach j of numlist 1 { egen c_vector_`j' = rowtotal(w`j'_g0_*) replace c_vector_`j' = . if sample_`j'!=1 *drop w_g0_* } ******************************************************************************** *** Identification step according to poverty cutoff k (20 33.33 50) *** ******************************************************************************** foreach j of numlist 1 { foreach k of numlist 20 33 50 { gen multidimensionally_poor_`j'_`k' = (c_vector_`j'>=`k'/100) replace multidimensionally_poor_`j'_`k' = . if sample_`j'!=1 //Takes value 1 if individual is multidimensional poor } } ******************************************************************************** *** Generate the censored vector of individual weighted deprivation count 'c(k)' ******************************************************************************** foreach j of numlist 1 { foreach k of numlist 20 33 50 { gen c_censured_vector_`j'_`k' = c_vector_`j' replace c_censured_vector_`j'_`k' = 0 if multidimensionally_poor_`j'_`k'==0 } //Provide a score of zero if a person is not poor } * ******************************************************************************** *** Define censored deprivation matrix 'g0(k)' *** ******************************************************************************** foreach j of numlist 1 { foreach var in ${est_`j'} { gen g0`j'_k_`var' = g0`j'_`var' replace g0`j'_k_`var' = 0 if multidimensionally_poor_`j'_33==0 replace g0`j'_k_`var' = . if sample_`j'!=1 } } ******************************************************************************** *** Generates Multidimensional Poverty Index (MPI), *** Headcount (H) and Intensity of Poverty (A) *** ******************************************************************************** *** Multidimensional Poverty Index (MPI) *** foreach j of numlist 1 { foreach k of numlist 20 33 50 { sum c_censured_vector_`j'_`k' [iw = sample_weight] if sample_`j'==1 gen MPI_`j'_`k' = r(mean) lab var MPI_`j'_`k' "MPI with k=`k'" } sum c_censured_vector_`j'_33 [iw = sample_weight] if sample_`j'==1 gen MPI_`j' = r(mean) lab var MPI_`j' "`j' Multidimensional Poverty Index (MPI = H*A): Range 0 to 1" *** Headcount (H) *** sum multidimensionally_poor_`j'_33 [iw = sample_weight] if sample_`j'==1 gen H_`j' = r(mean)*100 lab var H_`j' "`j' Headcount ratio: % Population in multidimensional poverty (H)" *** Intensity of Poverty (A) *** sum c_censured_vector_`j'_33 [iw = sample_weight] if multidimensionally_poor_`j'_33==1 & sample_`j'==1 gen A_`j' = r(mean)*100 lab var A_`j' "`j' Intensity of deprivation among the poor (A): Average % of weighted deprivations" *** Population vulnerable to poverty (who experience 20-32.9% intensity of deprivations) *** gen temp = 0 replace temp = 1 if c_vector_`j'>=0.2 & c_vector_`j'<0.3332 replace temp = . if sample_`j'!=1 sum temp [iw = sample_weight] gen vulnerable_`j' = r(mean)*100 lab var vulnerable_`j' "`j' % Population vulnerable to poverty (who experience 20-32.9% intensity of deprivations)" drop temp *** Population in severe poverty (with intensity 50% or higher) *** gen temp = 0 replace temp = 1 if c_vector_`j'>0.49 replace temp = . if sample_`j'!=1 sum temp [iw = sample_weight] gen severe_`j' = r(mean)*100 lab var severe_`j' "`j' % Population in severe poverty (with intensity 50% or higher)" drop temp } * *** Censored Headcount *** foreach j of numlist 1 { foreach var in ${est_`j'} { sum g0`j'_k_`var' [iw = sample_weight] if sample_`j'==1 gen cen`j'_`var' = r(mean)*100 lab var cen`j'_`var' "Censored Headcount: Percentage of people who are poor and deprived in `var'" } } *** Dimensional Contribution *** foreach j of numlist 1 { foreach var in ${est_`j'} { gen cont`j'_`var' = (w`j'_`var' * cen`j'_`var')/MPI_`j' if sample_`j'==1 lab var cont`j'_`var' "% Contribution in MPI of indicator..." } } ** The line below produces the variance (inequality among the poor) ** sum c_vector_1 if c_vector_1>=1/3 & c_vector_1<=1 [aw = sample_weight], detail gen var=r(Var) *** Prepare results to export *** keep /*country year survey*/ per_sample_weighted* per_sample* MPI* H* A* vulnerable* severe* raw* cen* cont* var *gen temp = (_n) *keep if temp==1 *drop temp order MPI_1 H_1 A_1 var severe_1 vulnerable_1 cont1_nutr cont1_edu_1 cont1_atten_1 cont1_fuel_1 cont1_toilet_1 cont1_water_1 cont1_elec_1 cont1_house_1 cont1_asset_1 per_sample_1 per_sample_weighted_1 raw1_nutri_1 raw1_edu_1 raw1_atten_1 raw1_fuel_1 raw1_toilet_1 raw1_water_1 raw1_elec_1 raw1_house_1 raw1_asset_1 cen1_nutri_1 cen1_edu_1 cen1_atten_1 cen1_fuel_1 cen1_toilet_1 cen1_water_1 cen1_elec_1 cen1_house_1 cen1_asset_1 codebook, compact /* ** child mortality for women 20-49y ** use "$path_in/CS_ADULTOS.dta", clear keep p8_1 p8_8 p8_9 p8_10 p8_11_1 p8_11_2 p8_11_3 p8_11_4 p8_11_5 upm viv_sel hogar numren edad sexo *** Household unique id gen double hh_id = upm*1000 + viv_sel*10 + hogar lab var hh_id "Household ID" *** Individual unique id gen double ind_id = hh_id*100 + numren label var ind_id "Individual ID" keep if sexo==2 & edad>=20 & edad<=49 * 14,936 gen child_died = 0 if p8_1==0 /* never had sex */ replace child_died = 0 if p8_8==2 /* never pregnant */ replace child_died = 0 if p8_11_4==0 & p8_11_5==0 /* no child died */ replace child_died = 0 if p8_11_3==0 & ((p8_11_1>0 & p8_11_1<.) | (p8_11_2>0 & p8_11_2<.)) /* abortions and stillbirths are considered not deprived */ replace child_died = 1 if (p8_11_4>=1 & p8_11_4<.) | (p8_11_5>=1 & p8_11_5<.) /* at least one child died */ keep hh_id ind_id child_died sort hh_id ind_id save "$path_out/women20_49.dta", replace ** child mortality for adolescent 12-19y ** use "$path_in/CS_ADOLESCENTES.dta", clear keep p2_8 p2_18 p2_19 p2_20 p2_21_1 p2_21_2 p2_21_3 p2_21_4 p2_21_5 upm viv_sel hogar numren edad sexo *** Household unique id gen double hh_id = upm*1000 + viv_sel*10 + hogar lab var hh_id "Household ID" *** Individual unique id gen double ind_id = hh_id*100 + numren label var ind_id "Individual ID" keep if sexo==2 & edad>=12 & edad<=19 * 7,031 girls gen child_died = 0 if p2_8==0 /* never had sex */ replace child_died = 0 if p2_18==2 /* never pregnant */ replace child_died = 0 if p2_21_4==0 & p2_21_5==0 /* no child died */ replace child_died = 0 if p2_21_3==0 & ((p2_21_1>0 & p2_21_1<.) | (p2_21_2>0 & p2_21_2<.)) /* abortions and stillbirths are considered not deprived */ replace child_died = 1 if (p2_21_4>=1 & p2_21_4<.) | (p2_21_5>=1 & p2_21_5<.) /* at least one child died */ keep hh_id ind_id child_died sort hh_id ind_id append using "$path_out/women20_49.dta" gen women12_49 = 1 sort hh_id ind_id save "$path_out/women12_49.dta", replace */